<?php

session_start();

if(isset($_SESSION['emaild']))
{
	$user=$_SESSION['emaild'];
}
else	
{
	$user="Anonymous";
	
}

require 'dbconnect.inc.php';

//this inserts annotations into database
$annotation=$_GET['annotation'];
$text=$_GET['text'];
$start=$_GET['startpos'];
$end=$_GET['endpos'];
$datestamp=date('Y-m-d');
$user="pakshal";

$mysql_table="content";

$query="insert into $mysql_table (text,annotation,date,spos,epos,user)	
values('$text','$annotation','$datestamp','$start','$end','$user')";

if($text!='null' && $annotation!='null' && $text!="" && $annotation!=""){	
	$queryresult=mysqli_query($link,$query) or die($conn_error_msg);
}

mysqli_close($link);

echo '<script type="text/javascript">
		window.location.href = "retrieve_annotations.inc.php?text="+'.$start.';
		</script>';

//include 'retrieve_annotations.inc.php?text=$start';
//echo 'success!';
//header('Location: main.php');
?>
